<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="../templates/main.xhtml">
	<ui:define name="title">Users</ui:define>
	<ui:define name="content">

		<h:form id = "table">
			<h:dataTable id="userstable" value="#{userBean.allUsers}" var="item"
				bgcolor="#FFFFFF" border="1" cellpadding="1" cellspacing="1"
				first="0" rows="#{userBean.allUsersSize}" dir="LTR" width="500px"
				rules="all">

				<f:facet name="header">
					<h:outputText value="Users" style="text-align: center"/>
				</f:facet>

				<h:column>
					<f:facet name="header">
						<h:outputText value="Логін" />
					</f:facet>
					<h:outputText value="#{item.name}">
					</h:outputText>
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="Роль" />
					</f:facet>
					<h:outputText
						value="#{item.type}">
					</h:outputText>
				</h:column>
 
				<h:column>
					<f:facet name="header">
						<h:outputText value="Редагувати" />
					</f:facet>
					<h:commandLink action="#{userBean.goToEditUser}">
						<h:graphicImage url="/img/edit.png" style="border:0; margin:auto"></h:graphicImage>
					</h:commandLink>
				</h:column>
				
				<h:column>
					<f:facet name="header">
						<h:outputText value="Видалити" />
					</f:facet>
					<h:commandLink action="#{userBean.goToDeleteUser}">
						<h:graphicImage url="/img/delete.png" style="border:0; margin:auto"></h:graphicImage>
					</h:commandLink>
				</h:column>
			</h:dataTable>
			<br/>
			<h:commandButton id="btnAdd" action="#{userBean.goToAddNewUser}" value="Додати нового користувача" />
		</h:form>

	</ui:define>

</ui:composition>

</html>